//
//  CBJStatuesToolBarView.swift
//  Weibo
//
//  Created by 崔健 on 16/5/25.
//  Copyright © 2016年 cbj. All rights reserved.
//

import UIKit

class CBJStatuesToolBarView: UIView {


    override init(frame: CGRect) {
        
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setupUI(){
    
        addSubview(reTweetedBtn)
        addSubview(commentBtn)
        addSubview(ohYeahBtn)
        reTweetedBtn.snp_makeConstraints { (make) in
            
            make.top.left.bottom.equalTo(self)
        }
        
        commentBtn.snp_makeConstraints { (make) in
            
            make.top.bottom.equalTo(self)
            make.left.equalTo(reTweetedBtn.snp_right)
            make.width.equalTo(reTweetedBtn)
        }
        
        ohYeahBtn.snp_makeConstraints { (make) in
            
            make.top.right.bottom.equalTo(self)
            make.left.equalTo(commentBtn.snp_right)
            make.width.equalTo(commentBtn)
        }
        
        // 添加分割线
        let sepWidth = 1 / UIScreen.mainScreen().scale
        let sepView1 = UIView()
        let sepView2 = UIView()
        sepView1.backgroundColor = UIColor.blueColor()
        sepView2.backgroundColor = UIColor.blueColor()
        
        addSubview(sepView1)
        addSubview(sepView2)
        
        sepView1.snp_makeConstraints { (make) in
            
            make.left.equalTo(reTweetedBtn.snp_right)
            make.width.equalTo(sepWidth)
            make.centerY.equalTo(self)
            make.height.equalTo(self.snp_height).multipliedBy(0.6)
        }
        
        sepView2.snp_makeConstraints { (make) in
            
            make.left.equalTo(commentBtn.snp_right)
            make.width.height.centerY.equalTo(sepView1)
        }
        
        
    }
    
    private lazy var reTweetedBtn : UIButton = {
    
        let btn = UIButton()
        btn.setTitle("转发", forState: .Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(10)
        btn.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        btn.setBackgroundImage(UIImage.init(named: "timeline_card_bottom_background"), forState: .Normal)
        btn.setImage(UIImage.init(named: "timeline_icon_retweet"), forState: .Normal)
        btn.sizeToFit()
        return btn
    }()
    private lazy var commentBtn : UIButton = {
    
        let btn = UIButton()
        btn.setTitle("评论", forState: .Normal)
        btn.setImage(UIImage.init(named: "timeline_icon_comment"), forState: .Normal)
        btn.setBackgroundImage(UIImage.init(named: "timeline_card_bottom_background"), forState: .Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(10)
        btn.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        btn.sizeToFit()
        return btn
    }()
    private lazy var ohYeahBtn : UIButton = {
    
        let btn = UIButton()
        btn.setTitle("点赞", forState: .Normal)
        btn.setImage(UIImage.init(named: "timeline_icon_like"), forState: .Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(10)
        btn.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        btn.setBackgroundImage(UIImage.init(named: "timeline_card_bottom_background"), forState: .Normal)
        btn.sizeToFit()
        return btn
    }()
    
}
